<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{dede:global.cfg_webname/}</title>
<meta name="description" content="{dede:global.cfg_description/}" />
<meta name="keywords" content="{dede:global.cfg_keywords/}" />
<link href="{dede:global.cfg_templets_skin/}/liqi/css/base.css" rel="stylesheet" media="screen" type="text/css" />
<link href="{dede:global.cfg_templets_skin/}/liqi/css/style.css" rel="stylesheet" media="screen" type="text/css" />
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmspath/}/images/js/j.js" ></script>
<script language="javascript" type="text/javascript" src="{dede:global.cfg_templets_skin/}/js/pic_scroll.js"></script>
<script language="javascript" type="text/javascript" src="{dede:global.cfg_cmsurl/}/include/js/jquery/jquery.js"></script>
<script language="javascript" type="text/javascript" src="{dede:global.cfg_templets_skin/}/liqi/js/liqi.js" ></script>

<script type="text/javascript">
<!--
function MM_showHideLayers() { //v9.0a
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function menuClick(index) {
  var displayType = $("#subMenu"+index).css('display');
  $("div[id^='subMenu']").hide();
  var obj = $('#subMenu'+index);
  if('none' == displayType) {
       $("#subMenu"+index).show();
  } else {
       $("#subMenu"+index).hide();
        }
}

	// 展开窗帘 value：窗帘div的id
	function menu_expand(value) {
		//打开之前合闭所有的窗帘
        var displayType = $("#sub"+value).css('display');
		$("ul[id^='submenu']").hide();
		// div状态切换，如果当前是打开，点击就关闭； 如果当前状态是关闭 ，点击就打开。
        if('none' == displayType) {
        	$("#sub"+value).show();
        } else {
        	$("#sub"+value).hide();
        }
        // var displayType = $("#sub"+value).toggle();
       // var displayType = document.getElementById('ulbox1').style.display;
	}

	function setJgHref(obj,value) {
		return true;
	}
	
	function setAreaHref(obj,value) {
		return true;
	}
	
	/*
	 * 得到查询条数
	 */
	function getOtherRows() {
	   var obj_table = document.getElementById('rowIds');
	   if(null != obj_table ) {
	      var length = obj_table.rows.length;
		  if(length < 10) {
		     // 显示隐藏的table 
			 var obj_otherTable = document.getElementById('otherRows');
			 if(null != obj_otherTable) {
			     // http://localhost/dede/plus/list.php?channelid=17&tid=12&s4pp=500&s4jg=0&infotype=0&level=0&area=0
			     var s4pp = url_request('s4pp');
				 var s4jg = url_request('s4jg');
				 var level = url_request('level');
				 var area = url_request('area');
				 var page = 11 - length;
				 //alert('s4pp===' +s4pp+ 's4jg==' +s4jg+ 'level=='+level+ 'area=='+area );
				 var params = {'s4pp':s4pp,'s4jg':s4jg,'level':level,'area':area,'page':page};
				 getDatas(params);
			     obj_otherTable.style.display = "block";
			 }
		  }
	   }
	}
	
	// 得到ajax返回值 
	function getDatas(params){
        $.post("../plus/list_4sks_other.php",params,function(data){
            $("#otherRows").html(data);
        });
    }
	
	//解析url参数
	function url_request(strName){
		var strHref = document.location.toString();
		var intPos = strHref.indexOf("?");
		var strRight = strHref.substr(intPos + 1); //获取到右边的参数部分
		var arrTmp = strRight.split("&"); //以&分割成数组

		for (var i = 0; i < arrTmp.length; i++){ //循环数组
			var dIntPos = arrTmp[i].indexOf("=");
			var paraName = arrTmp[i].substr(0, dIntPos);
			var paraData = arrTmp[i].substr(dIntPos + 1);
			if (paraName.toUpperCase() == strName.toUpperCase()) {
				return paraData;
			}
		}
		return "";
}


	
	
//-->
</script>

<script language="javascript">
    $(document).ready(function(){
        isLogin();
    });

</script>
</head>

<body onload="getOtherRows()">
	<form>
	<!--top-->
		<div class="w1002 bc topbar">
			<!--topbar-->
			<div class="pr12 clearfix">  
					<ul>
						<li class="fr">
						<a href="javascript:void(0);" onclick="window.open('{dede:global.cfg_cmsurl/}/plus/list.php?tid=25');return false;"><span>帮助中心</span></a>
					   </li>
						<li class="fr" id="denglu">
							<a  target="_blank" href="/member/login.php">登 录</a>
						</li>
						<li class="fr" id="zhuce">
							<a  target="_blank" href="/member/index_do.php?fmdo=user&dopost=regnew">注 册</a>
						</li>
					</ul>
					
					<li class="fr" id="tuichu" >
							
				   </li>
						
					<ul class="fr">
						<li>
							<marquee width="452" height="19">{dede:myad name='index_top_word'/}</marquee>
						</li>
					</ul>
			</div>
	    </div>
	    <!--end of topbar-->
	    
	    <div class="w1002 bc">
	    <!--hearder-->
	    <div class=" hearder clearfix">
	    	<div class="logo fl">
	        	<h1>
	            	<a href="#">{dede:myad name='web_logo'/}</a>
	            </h1>
	        </div>
	        <div class="pic_ad1 fr">
	        	<a>{dede:myad name='index_top_right'/}</a>
	        </div>
	    </div>
	    </div>
	    <!--end of hearder-->
	    
	    <!--nav 导航菜单-->
	    <div class="nav w1002 bc">
	       <ul>
			     <li><a href='{dede:global.cfg_cmsurl/}/'><span>首&nbsp;&nbsp;&nbsp;&nbsp;页</span></a></li>
			     {dede:channel type='top' row='10' currentstyle="
			     	<li ><a class='selected' href='~typelink~' ~rel~><span>~typename~</span></a></li>
			     "}
			     <li><a href='[field:typeurl/]' [field:rel/]><span>[field:typename/]</span></a></li>
			     {/dede:channel}
		    </ul>
	    </div>
	    <!--end of nav-->
	    
	    <!--end of top-->
    <!--main-->
    <div class="w1002 bc main clearfix">
    <div class="position">
    	<em><a><em>新车网</em></a><SPAN>»</SPAN></em>
        <em><strong>
           <!--系统默认的方式是 栏目1 > 栏目2 > 栏目3  ， 其中' > '(两边是由空格的 )是在 系统基本参数 --核心参数 --   栏目位置的间隔符号 设置的 ，
                                       如果修改的话，相应的页面栏目也要设置 。  -->
          {dede:field name='position' runphp='yes'}
        	$t_arry = explode(" > ",@me);
        	if(count($t_arry) > 1) {
        	    @me = $t_arry[1] ;
        	}else {
        		@me; 
        	}
          {/dede:field}
        </strong></em>
    </div>
    	<!--左边快捷菜单-->
    	<div class="right fl clearfix">
            <div class="k_link mb8"><!--快速链接1-->
            	<h1 class="clearfix"><span>上海汽车经销商</span><i></i></h1>
                <div class="con_3 clearfix" id="test1"> 
                	<ul>
						{dede:php}
						   // 查询数据库 返回列表 
						   // 上海的十三个区
						   $arear_arr = array();
						   $areaSql = "SELECT * FROM dede_sys_enum t WHERE t.egroup='area'";
						   $con = mysql_connect($cfg_dbhost,$cfg_dbuser,$cfg_dbpwd);
							mysql_select_db($cfg_dbname, $con);
							mysql_query("SET NAMES ".$cfg_db_language); 
						   $areaQuery = mysql_query($areaSql);
						   while($row = mysql_fetch_array($areaQuery,MYSQL_ASSOC)) {
							      $arear_arr[$row["ename"]] = $row["ename"];
								  
							}
							
							$mysql = "SELECT t1.id,t1.title,t2.area,t2.shopName,t2.address FROM dede_archives t1 LEFT JOIN dede_addon4sks t2 ON t1.id = t2.aid WHERE t2.typeid='12' AND  t2.sftjjxs = '是' limit 0,15"; 
							$query = mysql_query($mysql); 
							$n=mysql_num_rows($query);
							echo '<li id="menu0" ><a href="javascript:void(0)" onclick="menuClick(\'0\')"><strong>推荐经销商</strong>(<span>'.$n.'</span>)</a></li>
						          <div  id="subMenu0" > ';
							while($row = mysql_fetch_array($query,MYSQL_ASSOC)) {
							      $sName = $row["shopName"];
							      if(strlen($sName) > 39) {
								    $sName =  mb_substr($row["shopName"],0,13,'UTF-8')."...";
								  }
							      echo '<a  title="'.$row["shopName"].'" target="_blank" href="./view.php?aid='.$row["id"].'" >'.$sName.'</a></br>';
								  
							}
							echo '</div>';
							
							$mysql = "SELECT t1.id,t1.title,t3.ename as area,t2.shopName,t2.address FROM dede_archives t1 LEFT JOIN dede_addon4sks t2 ON t1.id = t2.aid left join dede_sys_enum t3 on t2.area = t3.disorder  WHERE t3.egroup='area' and t2.typeid='12'"; 
							$query = mysql_query($mysql); 
							
							$area_index = 0;
							foreach ($arear_arr as $value ) {
							    $area_index ++;
								$divStr = "";
								$totalCount = 0;
								mysql_data_seek($query,0); // 移动指针到数组的开始
								while($row = mysql_fetch_array($query,MYSQL_ASSOC)) {
									  if($row["area"] == $value) {
									  	  $sName = $row["shopName"];
										  if(strlen($sName) > 39) {
											$sName =  mb_substr($row["shopName"],0,13,'UTF-8')."...";
										  }
										   $divStr .= '<a title="'.$row["shopName"].'" target="_blank" href="./view.php?aid='.$row["id"].'">'.$sName.'</a></br>';
										   $totalCount ++;
									  }
								}
								echo '<li id="menu'.$area_index.'"><a href="javascript:void(0)" onclick="menuClick(\''.$area_index.'\')"><strong>'.$value.'</strong>(<span>'.$totalCount.'</span>)</a></li>
									  <div style="display:none" id="subMenu'.$area_index.'"> '
										.$divStr.
									   '</div>';
							}	

						  // mysql_close($con);

						 {/dede:php}
						
                    </ul>
                </div>
            </div>
			{dede:myad name='item_bottom_right'/}
        </div>
        <!--右边结束-->
        <!--左边开始-->
        <div class="fl mr12 pt9 w746 clearfix">
        	<!--过滤信息-->
            <div class="ks mb8 clearfix" >
			   {dede:infolink}
            	<h1 class="mb8"><span>4S快搜</span></h1>
                <dl class="clearfix"><!--过滤条件1-->
                	<dt>按价格</dt>
                    <dd class="clearfix">
                    	<ul class="clearfix">
                    		<li style="word-break:keep-all;">[field:s4jg/]&nbsp;</li>
                      </ul>
                    </dd>
                </dl>
                <!--条件1结束-->
                <dl class="clearfix"><!--过滤条件2-->
                	<dt>按品牌</dt>
                    <dd class="clearfix">
                    	<ul class="clearfix">
                    		<li style="word-break:keep-all;">[field:s4pp/]&nbsp;</li>
                     </ul>
                    </dd>
                </dl>
                <!--条件2结束-->
                <dl class="clearfix"><!--过滤条件3-->
                	<dt>按区域</dt>
                    <dd class="clearfix">
                    	<ul class="clearfix">
                    		<li style="word-break:keep-all;">[field:area/]&nbsp;</li>
                        </ul>
                    </dd>
                </dl>
                <!--条件3结束-->
                <dl class="clearfix"><!--过滤条件4-->
                	<dt>按级别</dt>
                    <dd class="clearfix">
                    	 <ul class="clearfix">
                    		<li style="word-break:keep-all;">[field:level/]&nbsp;</li>
                       </ul>
                    </dd>
                </dl>
                <!--条件4结束-->
				{/dede:infolink}
            </div>
            <!--过滤信息结束-->
            <!--list-->
            <div class="mb8  lm clearfix">
            	<div class="list mb8">
            	<table id="rowIds" width="100%" border="0" cellspacing="0" cellpadding="0">
					  <tr>
						<th class="t_1">店名</th>
						<th>地址</th>
						<th>销售热线</th>
						<th class="t_2">口碑</th>
					  </tr>

					      {dede:list pagesize='10'}
                          [field:global name='autoindex' runphp='yes']
                          	if(@me%2 == 0){
                          	 	@me = '<tr>';
                          	} else {
                          		@me = '<tr class="gray">';
                          	}
                          [/field:global]
                          <td><a  target="_blank" href="[field:arcurl/]"><strong>[field:shopname/]</strong></a></td>
							 <td>[field:address/]</td>
							 <td>[field:saleshotline/]</td>
							 <td class="t_cen">[field:mouthword/]</td>
						   </tr>
			            {/dede:list}
					
				</table>
				</div>
				 <div class="pager">
                	<ul>
                    	{dede:pagelist listitem="info,index,pre,pageno,next,end" listsize="5"/}
                  </ul>
               </div>
			     </br></br>
			    <div class="list mb8" id="otherRows" style="display:none" >
			       <!--插入其他经销商-->
               </div >				
          </div>
            <!--end of list-->
        </div>
        <div class="clear"></div><!--不要删除这个div-->
        <!--连接 start -->
         <div class="links clearfix mb8">
            	<div class="clearfix">
            		<h1 class="fl">友情链接</h1>
                	<i class="fl">Links</i>
                </div>
                <div class="clearfix con">
                	<ul>
                	     {dede:arclist typeid="20" row=50 orderby=pubdate}
				         	<li><a href="[field:arcurl/]">[field:title/]</a></li>
				         {/dede:arclist}
                    </ul>
                </div>
         </div>
         <!--连接 end -->
   </div>
            <!--end of main-->
    <!--footer-->
   {dede:include file='./liqi/item_footer.htm' /}    	
    <!--end of footer-->
    </form>
</body>
</html>
